<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DIV的绕圈运动</title>
    <script src="../util.js"></script>
    <style>
        div{
            width: 200px;
            height: 200px;
            position: absolute;
            left: 0;
            top: 0;
            background: palevioletred;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        var box = document.querySelector('div')
        var ismove = false  // div 是静止的
        box.onclick = function(){
            if(!ismove){
                ismove = true
                utils.move(this,'left',800,2000,()=>{
                    utils.move(this,'top',500,2000,()=>{
                        utils.move(this,'left',0,2000,()=>{
                            utils.move(this,'top',0,2000,()=>{
                                ismove = false
                            })
                        })
                    })
                })
            }
            
        }
    </script>
</body>
</html>